package net.wofly.cashier.dishes.service.impl;

import net.wofly.cashier.dishes.domain.DailyCommodityNum;
import net.wofly.cashier.dishes.repository.DailyCommodityNumRepository;
import net.wofly.cashier.dishes.service.IDailyCommodityNumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service("iDailyCommodityNumService")
@Transactional
public class DailyCommodityNumServiceImpl implements IDailyCommodityNumService {
    
    @Autowired
    DailyCommodityNumRepository dailyCommodityNumRepository;
    
    @Override
    public DailyCommodityNum save(DailyCommodityNum entity) {
        return dailyCommodityNumRepository.save(entity);
    }
    
    @Override
    public void delete(DailyCommodityNum entity) {
        dailyCommodityNumRepository.delete(entity);
    }
    
    @Override
    public void delete(String key) {
        dailyCommodityNumRepository.delete(key);
    }
    
    @Override
    public DailyCommodityNum findOne(String key) {
        return dailyCommodityNumRepository.findOne(key);
    }
    
    @Override
    public List<DailyCommodityNum> save(List<DailyCommodityNum> entityList) {
        return (List<DailyCommodityNum>) dailyCommodityNumRepository.save(entityList);
    }
    
    @Override
    public DailyCommodityNum findByCommodityIDAndSetDate(String commodityID, Long setDate) {
        return dailyCommodityNumRepository.findByCommodityIDAndSetDate(commodityID, setDate);
    }
}
